home *** CD-ROM | disk | FTP | other *** search
/ Diccionario Visual Trilingue / VISUAL.iso / SHARED.DIR / 10130_Algorithmes de recherche (contenu).ls < prev    next >
Encoding:
Text File  |  1997-07-04  |  4.1 KB  |  111 lines

  1. global gTitleList, gTitleID, gTitlePicList, gTitleObj, gNbItemC, gPicListC, gPicListAllC, gPicLabelIDC, gPicPeteOffsetC, gContenuPicObj, gPicMovieNumC
  2.  
  3. on FindTitles pos
  4.   watchCursor()
  5.   set MaxLengthLine to 2275
  6.   set gTitleList to []
  7.   set gTitleID to []
  8.   set gTitlePicList to []
  9.   setAt(gNbItemC, 2, 0)
  10.   set the visible of sprite 18 to 0
  11.   gTitleObj(mSetPosition, (pos - 1) * (MaxLengthLine + 1))
  12.   set TermLine to gTitleObj(mReadLine)
  13.   set the itemDelimiter to "├É"
  14.   set numberofTitle to the number of items in TermLine / 3
  15.   set i to 0
  16.   repeat while i < numberofTitle
  17.     set the text of cast 10100 to "                    " & string(i * 100 / numberofTitle) & "%"
  18.     add(gTitleList, item 1 of TermLine)
  19.     delete item 1 of TermLine
  20.     add(gTitleID, item 1 of TermLine)
  21.     delete item 1 of TermLine
  22.     add(gTitlePicList, value(item 1 of TermLine))
  23.     delete item 1 of TermLine
  24.     set i to i + 1
  25.   end repeat
  26.   set the itemDelimiter to ","
  27.   setAt(gNbItemC, 2, count(gTitleList))
  28.   ClearCursor()
  29. end
  30.  
  31. on FindPicsC TermPos
  32.   watchCursor()
  33.   set gPicListC to []
  34.   set gPicListAllC to []
  35.   set gPicLabelIDC to []
  36.   set gPicPeteOffsetC to []
  37.   set gPicMovieNumC to []
  38.   setAt(gNbItemC, 3, 0)
  39.   set ListPicTemp to [:]
  40.   set the visible of sprite 25 to 0
  41.   set NbPic to count(getAt(gTitlePicList, TermPos))
  42.   set the itemDelimiter to "├É"
  43.   if NbPic > 5 then
  44.     repeat with i = 1 to NbPic
  45.       set the text of cast 10101 to "                    " & string(i * 100 / NbPic) & "%"
  46.       set PicFilePos to getAt(getAt(gTitlePicList, TermPos), i)
  47.       gContenuPicObj(mSetPosition, PicFilePos)
  48.       set PicLine to gContenuPicObj(mReadLine)
  49.       set listtmp to []
  50.       add(listtmp, item 1 of PicLine)
  51.       delete item 1 of PicLine
  52.       add(listtmp, value(item 1 of PicLine))
  53.       delete item 1 of PicLine
  54.       add(listtmp, value(item 1 of PicLine))
  55.       delete item 1 of PicLine
  56.       add(listtmp, value(item 1 of PicLine))
  57.       delete item 1 of PicLine
  58.       addProp(ListPicTemp, getAt(listtmp, 1), listtmp)
  59.     end repeat
  60.   else
  61.     repeat with i = 1 to NbPic
  62.       set PicFilePos to getAt(getAt(gTitlePicList, TermPos), i)
  63.       gContenuPicObj(mSetPosition, PicFilePos)
  64.       set PicLine to gContenuPicObj(mReadLine)
  65.       set listtmp to []
  66.       add(listtmp, item 1 of PicLine)
  67.       delete item 1 of PicLine
  68.       add(listtmp, value(item 1 of PicLine))
  69.       delete item 1 of PicLine
  70.       add(listtmp, value(item 1 of PicLine))
  71.       delete item 1 of PicLine
  72.       add(listtmp, value(item 1 of PicLine))
  73.       delete item 1 of PicLine
  74.       addProp(ListPicTemp, getAt(listtmp, 1), listtmp)
  75.     end repeat
  76.   end if
  77.   set the itemDelimiter to ","
  78.   repeat with i = 1 to count(ListPicTemp)
  79.     set thePic to getAt(getAt(ListPicTemp, i), 1)
  80.     set thePicTemp to thePic
  81.     set posOmega to offset("@", thePic)
  82.     if posOmega > 0 then
  83.       set thePic to chars(thePic, 1, posOmega - 1) & ": " & chars(thePic, posOmega + 1, length(thePic))
  84.     end if
  85.     set posTruncMark to offset("ΓǪ", thePic)
  86.     set posParenthese to offset("((", thePic)
  87.     if posTruncMark > 0 then
  88.       if posParenthese > 0 then
  89.         set thePic to chars(thePic, 1, posParenthese + 3)
  90.         set thePic to chars(thePic, 1, posParenthese - 1) & chars(thePic, posParenthese + 1, length(thePic))
  91.         set thePicTemp to chars(thePicTemp, 1, posTruncMark - 1) & chars(thePicTemp, posParenthese + 4, length(thePicTemp))
  92.       else
  93.         set thePic to chars(thePic, 1, posTruncMark)
  94.         set thePicTemp to chars(thePicTemp, 1, posTruncMark - 1) & chars(thePicTemp, posTruncMark + 1, length(thePicTemp))
  95.       end if
  96.     else
  97.       if posParenthese > 0 then
  98.         set thePic to chars(thePic, 1, posParenthese - 1) & chars(thePic, posParenthese + 1, length(thePic))
  99.         set thePicTemp to chars(thePicTemp, 1, posParenthese - 2)
  100.       end if
  101.     end if
  102.     add(gPicListC, thePic)
  103.     add(gPicListAllC, thePicTemp)
  104.     add(gPicLabelIDC, getAt(getAt(ListPicTemp, i), 2))
  105.     add(gPicPeteOffsetC, getAt(getAt(ListPicTemp, i), 3))
  106.     add(gPicMovieNumC, getAt(getAt(ListPicTemp, i), 4))
  107.   end repeat
  108.   setAt(gNbItemC, 3, count(gPicListC))
  109.   ClearCursor()
  110. end
  111.